package com.zhou;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@EnableAutoConfiguration
@RestController
@ComponentScan(value = {"com.zhou.service", "com.zhou.config"})
public class SkywalkingBackend {
  @Autowired JdbcTemplate jdbcTemplate;

  @RequestMapping("/api") public String printDate() {
    log.info("1111111111");
    return jdbcTemplate.queryForObject("SELECT NOW()", String.class);
  }

  public static void main(String[] args) {
    SpringApplication.run(SkywalkingBackend.class,
        "--spring.application.name=backend",
        "--server.port=9000"
    );
  }
}
